package com.test.exercise.shared;

import lombok.Data;

/**
 * 通用返回类
 */
@Data
public class Result<T> {
    // 状态码
    private int code;
    // 消息
    private String message;
    // 数据
    private T data;

    public Result (String message, T data) {
        this.message = message;
        this.data = data;
    }

    public Result (T data) {
        this.data = data;
    }

    public static <T> Result<T> success(String message, T data) {
        return new Result<>(message, data);
    }

    public static <T> Result<T> success(T data) {
        return new Result<>(data);
    }
}
